home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / CLESSONS.ZIP / LESSON1 < prev    next >
Text File  |  1986-02-08  |  17KB  |  516 lines

  1. .NT
  2.  A NOTE ABOUT THE LESSONS in C 
  3. .b4-24
  4. .R5C4
  5. These were written while the author was ~Ilearning~N  the language and since
  6. .R6C4
  7. they  are  ~Ifree~N ( to  copy  and/or  distribute ) there  is  a money-back
  8. .R7C4
  9. guarantee on the accuracy of each and every statement in the lessons (!)
  10. .R9C4
  11. The  ~Idisplay~N  program was written ( in C ) in order to provide a vehicle
  12. .R10C4
  13. for displaying the lessons.
  14. .R12C5
  15. .B
  16. P.J.Ponzo
  17. .B
  18. Dept. of Applied Math
  19. .B
  20. Univ. of Waterloo
  21. .B
  22. Ontario N2L 3G1
  23. .K16,30
  24. PonzoTUTOR
  25. .WNT
  26.   Getting Started in C : INPUT and OUTPUT   
  27.     Using a word processor, we begin our C-program with ~b~Imain()~N and a
  28.     left curly bracket ~b~I{~N.  Now we can write a program and finish it 
  29.     with a right curly bracket: 
  30.  
  31. ~b~Imain() {~N
  32. ~b~I.........................~N
  33. ~b~Iyour program goes in here~N
  34. ~b~I.........................~N
  35. ~b~I}~N
  36.  
  37.     Everything between ~b~I{~N and ~b~I}~N constitutes the ~b~Imain()~N program.
  38.     One of the things we will want to do is print to the screen. There is
  39.     a C command called ~b~Iprintf~N, meaning ~b~Iprint~N with ~b~If~Normat.
  40.  
  41. ~b~Iprintf("this is some text to print.");~N
  42.  
  43.     The above command will simply print ~r~Ithis is some text to print.~N
  44.     The ~b~If~Normat part of ~b~Iprintf~N comes in handy if we want to print,
  45.     say, a number with a specified number of decimal places.
  46. .W
  47. .N
  48. .T
  49.   More on printf  
  50. .R4C1
  51. ~b~Iprintf("the answer is %6d",x);~N
  52. .R6C1
  53.     The above will print the value of the variable ~b~Ix~N.   
  54. .W
  55. .R4C1
  56. ~b~Iprintf("~Vthe answer is ~N~b~I%6d",x);~N
  57. .R6C1
  58.     This part just prints the words ~r~Ithe answer is ~N              
  59. .W
  60. .R4C1
  61. ~b~Iprintf("the answer is ~V%6~N~b~Id",x);~N
  62. .R6C1
  63.     This says the number ~b~Ix~N is printed to ~b~I6~N digits.        
  64. .W
  65. .R4C1
  66. ~b~Iprintf("the answer is %6~Vd~N~b~I",x);~N
  67. .R6C1
  68.     This says that a ~b~Id~Necimal is being printed.           
  69. .W
  70. .R4C1
  71. ~b~Iprintf("the answer is %6d",~Vx~N~b~I);~N
  72. .R6C1
  73.     Here is the variable ~b~Ix~N which is to be printed.        
  74. .w
  75. .W
  76. .R4C1
  77. ~b~Iprintf("the answer is %6d",x)~V;~N
  78. .R6C3
  79. ~I
  80. .B
  81.     ~R...and (almost) EVERY C STATEMENT ENDS IN A SEMI-COLON !  ~N
  82. .W
  83. .R11C1
  84.     Here's the whole program:
  85. ~b~Imain() {~N
  86. ~b~Ix=1234~N
  87. ~b~Iprintf("the answer is %6d",x);~N
  88. ~b~I}~N
  89.     and we expect the program to give the output: ~r~Ithe answer is   1234~N
  90.     ...but it WON'T ( yet ).
  91.  
  92.     (In fact, your ~IC-compiler~N won't compile the program!)
  93. .K17,60
  94. ...alas...
  95. .WNT
  96.   A look at DATA TYPES  
  97.     When we write ~b~Ix=1234~N we expect the C compiler to reserve some memory
  98.     for the variable ~b~Ix~N and place in this memory the number ~b~I1234~N.
  99.     If, subsequently, we write ~b~Ix=12345678~N, will this fit into the memory
  100.     reserved for the variable ~b~Ix~N?  
  101.  
  102.     In order to know ,in advance, how much memory to set aside for each
  103.     variable we use in our C program, we must declare the variable ~Itype~N.
  104.  
  105.     If ~b~Ix~N is an integer (so we will NOT set ~b~Ix=1.234~N) then we say
  106.     so with the declaration: ~b~Iint x;~N
  107.  
  108.     If ~b~Ix~N will take on values like ~b~I1.234~N (a ~Ifloating point~N
  109.     ~Inumber~N) then we write: ~b~Ifloat x;~N
  110.  
  111.     If ~b~Ix~N is a ~Icharacter~N variable (for example ~b~Ix='A'~N) then
  112.     we declare this too: ~b~Ichar x;~N
  113. .WNT
  114.   Declaring the DATA TYPE  
  115.     Now we may write:
  116.  
  117. ~b~Imain() {~N
  118. ~b~Iint x;~N
  119. ~b~Ix=1234;~N
  120. ~b~Iprint("the answer is %6d",x);~N
  121. ~b~I}~N
  122.     and NOW our program WILL print: ~r~Ithe answer is   1234~N
  123. .WR13C1
  124.     What will the following program print?
  125.  
  126. ~b~Imain() {~N
  127. ~b~Ifloat x;~N
  128. ~b~Ix=1234;~N
  129. ~b~Iprint("the answer is %6d",x);~N
  130. ~b~I}~N
  131. .K17,60
  132. I give up!
  133. .WN
  134. ~b~Imain() {~N
  135. ~V~Ifloat x;~N
  136. ~b~Ix=1234;~N
  137. ~b~Iprint("the answer is %6d",x);~N
  138. ~b~I}~N
  139.     Because we declared ~b~Ix~N to be a ~V~Ifloat~Ning point number
  140.     the value of ~b~Ix~N is stored in a different format, in memory.
  141.     As a ~V~Ifloat~N, ~b~Ix=1234~N will be stored as a number ~Iless than~N
  142.     ~I1~N together with an ~Iexponent~N ("scientific notation").
  143.  
  144.     The above program will print: ~r~Ithe answer is 0~N !!!
  145. .WR2C1
  146. ~b~Ifloat x;~N
  147. .R4C1
  148. ~b~Iprint("the answer is %6~Vd~N~b",x);~N        Note the ~Vd~N.
  149. .R13C1
  150.     The ~b~Iprintf~N command expected a number in ~V~Id~Necimal format.
  151.     But ~b~Ix~N was stored in memory in ~b~Ifloat~N format.
  152.     The result is a misinterpretation of the value of ~b~Ix~N by ~b~Iprintf~N!
  153. .K17,60
  154. all greek 
  155. .W
  156. .N
  157. ~b~Imain() {~N
  158. ~b~Ifloat x;~N
  159. ~b~Ix=1234;~N
  160. ~b~Iprint("the answer is %6~Vf~N~b",x);~N         Note the ~Vf~N
  161. ~b~I}~N                    
  162.     To tell ~b~Iprintf~N the format in which ~b~Ix~N was stored, we use an
  163.     ~V~If~N in the "format" portion of the ~b~Iprintf~N command (i.e. the
  164.     part within quotes).
  165. .WR4C1
  166. ~b~Iprint("the answer is %6f",x);~N
  167. .R10C1
  168. ~b~Imain() {~N
  169. ~b~Ichar x;~N
  170. ~b~Ix='A';~N
  171. ~b~Iprintf("As a character, x has the value %c",x);~N
  172. ~b~I}~N
  173.     What will this program print?
  174. .K17,60
  175. I give up!
  176. .WR17C1
  177. ~r~IAs a character, x has the value A~N
  178. .WNT
  179.     INTEGERS and FLOATS    
  180. .R4C1
  181. ~b~Ifloat x;~N
  182. ~b~Ix=1234+1/2;~N
  183.  
  184.     In the above program segment, what do you think the value of x is ?
  185. .W
  186.  
  187.     It's ~I1234.0~N !!!
  188. .sR5C1
  189. ~b~Ix=~V1234~N~b~I+~V1~N~b~I/~V2~N~b~I;~N
  190. .r
  191.  
  192.     Numbers like ~b~I1234~N and ~b~I1~N and ~b~I2~N are automatically ~b~Iint~Negers
  193.     and dividing the last two would give ~I0~N (dropping the fractional part!)
  194.     so ~I1234+0~N gives ~I1234~N which (because ~b~Ix~N is a ~b~Ifloat~Ning point
  195.     number) is NOW converted to a ~b~Ifloat~N and assigned to ~b~Ix~N !!!
  196.  
  197.     In order to yield the value ~I1234.5~N we ~Iinclude the decimal points~N:
  198.  
  199. ~b~Ix=1234.+1./2.;~N     
  200.  
  201.     and NOW all numbers are ~b~Ifloat~Ning point and ~b~Ix~N will be assigned the
  202.     value ~I1234.5~N so ...~Iinclude the decimal points~N when necessary!
  203. .WN
  204.  
  205. ~b~Ifloat x;~N
  206. ~b~Ix=1234+1./2.;~N
  207.  
  208.     Here the ~b~I1./2.~N is evaluated as ~b~I.5~N (a float, because of the decimal
  209.     points) and ~b~I1234~N is converted to a float then added, giving ~I1234.5~N
  210.     which is assigned to ~b~Ix~N.
  211.  
  212. ~b~Ifloat x;~N
  213. ~b~Ix=1234+1./2;~N
  214.  
  215.     Here, the decimal associated with ~b~I1.~N causes the ~b~I2~N to be converted
  216.     to a float, so ~b~I1./2~N gives ~I.5~N, and the addition of ~b~I1234~N (which
  217.     is first converted to a float) gives ~b~I1234.5~N, which is then assigned to ~b~Ix~N.
  218.  
  219.     The conclusion? ~IC~N tends to convert numbers in a ~Imixed~N expression to
  220.     ~b~Ifloat~Ning point before evaluation ....but don't rely on it! 
  221.  
  222.     If you want ~b~Ifloat~Ning point operations, ~Iinclude the decimal points!~N
  223. .WNT
  224.   INPUT from the KEYBOARD with scanf()  
  225.     Now that we've been introduced to ~b~Iprintf~N (which will print things
  226.     on the screen, or to the printer, or to a disk file, as we will see...)
  227.     we should introduce ~b~Iscanf~N which allows us to input numbers 'n' such
  228.     from the keyboard.
  229.  
  230. ~b~Imain() {~N
  231. ~b~Ichar x;~N
  232. ~V~Iscanf("%c",x);~N                             Note the ~V~I%c~N!
  233. ~b~Iprintf("You pressed the ~V%c~N~b key",x);~N        Note the ~V~I%c~N!
  234. ~b~I}~N
  235.     The ~b~Iscanf~N command waits for the user to type something, and
  236.     ~b~Iscanf("%c",x)~N puts the ~b~Ic~Nharacter typed, into the memory
  237.     reserved for the variable ~b~Ix~N. When the compiled program is run
  238.     it will wait for the user to press a key (followed by the ~IEnter~N key).
  239.  
  240.     Suppose you ran the program and pressed the ~Ia~N key (then ~IEnter~N).
  241.     What would the program print on the screen?
  242. .WR22C1
  243. ~r~IYou pressed the  key~N       ~IIT DIDN'T WORK!!!~N
  244. .WNT
  245.   About Memory Locations...and the & prefix    
  246.  
  247. ~b~Imain() {~N
  248. ~b~Ichar x;~N
  249. ~V~Iscanf("%c",x);~N
  250. ~b~Iprintf("You pressed the %c key",x);~N 
  251. ~b~I}~N
  252.     When ~b~Iscanf()~N is used, we must tell it WHERE, in memory, to put
  253.     the ~b~Ichar~Nacter ~b~Ix~N. Saying ~b~Iscanf("%c",x)~N is not enough!
  254.     To identify the ~Imemory address~N for the variable ~b~Ix~N, we prefix
  255.     ~b~Ix~N with ~b~I&~N.
  256.  
  257.     If ~b~Ix~N is ~Iany~N variable (~b~Iint~N or ~b~Ifloat~N or ~b~Ichar~N)
  258.     then ~b~I&x~N is the ~Iaddress~N in memory of ~b~Ix~N.
  259. .K17,60
  260. &x=address
  261. .WN
  262. ~b~Imain() {~N
  263. ~b~Ichar x;~N
  264. ~V~Iscanf("%c",x);~N
  265. ~b~Iprintf("You pressed the %c key",x);~N 
  266. ~b~I}~N
  267.  
  268.     The above program must be changed to read:
  269.  
  270. ~b~Imain() {~N
  271. ~b~Ichar x;~N
  272. ~b~Iscanf("%c",~V&x~N~b);~N                     Note the ~V&x~N.
  273. ~b~Iprintf("You pressed the %c key",x);~N 
  274. ~b~I}~N
  275.  
  276.     ...THEN it will wait for a key-press (for example the letter ~Iz~N)
  277.     and print: ~r~IYou pressed the z key~N
  278. .W
  279. .R18C1
  280.     Since ~b~Ichar x;~N reserved only enough space for ~IONE~N character,
  281.     what would the printout be if you pressed several keys...say ~Ipqr~N?
  282. .W
  283. .R21C1
  284. ~r~IYou pressed the p key~N       ~IJUST THE FIRST CHARACTER!~N
  285. .WNT
  286.     What's wrong with the following program? 
  287. .R4C1
  288. ~b~Imain() {~N
  289. ~V~Iint x;~N
  290. ~V~Ichar y;~N
  291. ~V~Ifloat z;~N
  292. ~b~Iprintf("Enter 3 numbers (separated by a space)");~N
  293. ~b~Iscanf("%d%c%f",&x,&y,&z);~N
  294. ~b~Iprintf("x=%c y=%f z=%d",x,y,z);~N
  295.  
  296.     Note that ~b~Ix~N, ~b~Iy~N and ~b~Iz~N are declared ~V~Iint~N, ~V~Ichar~N
  297.     and ~V~Ifloat~N.
  298. .WR5C1
  299. ~b~Iint x;~N
  300. ~b~Ichar y;~N
  301. ~b~Ifloat z;~N
  302. ~V~Iprintf("Enter 3 numbers (separated by a space)");~N
  303. .R12C1
  304.     This line just prints instructions:                                     
  305. ~r~IEnter 3 numbers (separated by a space)~N
  306. .WR8C1
  307. ~b~Iprintf("Enter 3 numbers (separated by a space)");~N
  308. ~V~Iscanf("%d%c%f",&x,&y,&z);~N
  309. .R12C1
  310.     This line waits for you to type in the 3 numbers (with spaces).
  311.     Note the ~V~I&x~N, ~V~I&y~N and ~V~I&z~N as required by ~V~Iscanf()~N!
  312. .W
  313. .R9C1
  314. ~b~Iscanf("%d%c%f",&x,&y,&z);~N
  315. ~V~Iprintf("x=%c y=%f z=%d",x,y,z);~N
  316. .R12C1
  317.     Now we ~V~Iprintf()~N the 3 numbers, expecting the printout to appear as:
  318. ~r~Ix=123 y=123 z=123~N  (assuming the 3 numbers were all ~I123~N).      
  319.  
  320.     What do you think gets printed on the screen?
  321. .W
  322. .R10C1
  323. ~b~Iprintf("x=~V%c~N~b y=~V%f~N~b z=~V%d~N~b",x,y,z);~N
  324. .R15C1
  325.     Alas, we gave ~b~Iprintf()~N the DATA TYPES in the wrong order!
  326.     Although ~b~Iscanf()~N got the ~b~Iint~Neger ~b~Ix~N as ~I123~N, and 
  327.     put it in the right memory location ('cause we said ~b~I&x~N)...and 
  328.     it also got ~b~Iy~N as ~I1~N (NOT 123), a single ~b~Ichar~N.....
  329.     (because the ~b~Iy~N memory location only holds a single character!)
  330.     and it also got ~b~Iz~N and stored it as a ~b~Ifloat~Ning point number,
  331.     and put it in the correct memory location...so ~Iwhat gets printed?~N
  332. .WN
  333. ~b~Imain() {~N
  334. ~b~Iint x;~N
  335. ~b~Ichar y;~N
  336. ~b~Ifloat z;~N
  337. ~b~Iprintf("Enter 3 numbers (separated by a space)");~N
  338. ~b~Iscanf("%d%c%f",%x,%y,%z);~N
  339. ~b~Iprintf("x=%c y=%f z=%d",x,y,z);~N
  340.  
  341.     The printout produced by the above program (after entering ~I123~N
  342.     for each of ~b~Ix~N, ~b~Iy~N and ~b~Iz~N, separated by a space) is:
  343.  
  344. ~r~Ix={ y=-2.000000 z=16478~N 
  345. .K2,60
  346. mamma mia!
  347.  
  348.     ...so ~b~Iprintf()~N was confused once more!
  349. ~I>~N It interpreted ~b~Ix~N as a ~b~I%c~Nharacter variable (!) and out came ~r~I{~N.
  350.     (the ASCII code for '{' is 123 ...but more on ASCII later).
  351. ~I>~N It printed the contents of ~Iseveral~N memory locations, starting with
  352.     the ~IONE~N reserved for ~b~Iy~N (a ~b~Ic~Nhar) as a ~b~I%f~Nloating point
  353.     number (and out came ~r~I-2.000000~N).
  354. ~I>~N Finally, it went to the memory location reserved for ~b~Iz~N (which held
  355.     a ~b~If~Nloating point number ... in "scientific" format, remember?)
  356.     and interpreted it as an ~b~Ii~Nnteger, namely ~r~I16478~N !!!
  357. .WNT
  358.    REVIEW of printf() and scanf()  
  359. .R4C1
  360. ~b~Iprintf("~Vtext and 'format' info~N~b",variable names separated by commas);~N
  361.  
  362. ~b~Iscanf("NO TEXT, just 'format' info",variable names separated by commas);~N
  363.  
  364.     We must give ~b~Iprintf()~N information about the 'format' of the
  365.     variables which are to be printed. Text may be mixed with the various
  366.     ~b~I%d~N, ~b~I%c~N and ~b~I%f~N format information.
  367. .W
  368. .R4C1
  369. ~b~Iprintf("text and 'format' info",~Vvariable names separated by commas~N~b);~N
  370. .R12C1
  371.     In here goes the variables to be printed (if any).
  372. .W
  373. .R4C1
  374. ~b~Iprintf("text and 'format' info",variable names separated by commas);~N
  375.  
  376. ~b~Iscanf("~VNO TEXT, just 'format' info~N~b",variable names separated by commas);~N
  377. .R14C1
  378.     In here goes ~IONLY~N format information for ~b~Iscanf()~N.
  379. .W
  380. .R6C1
  381. ~b~Iscanf("NO TEXT, just 'format' info",~Vvariable names separated by commas~N~b);~N
  382. .R16C1
  383.     In here goes the names of the variables, like ~b~Ix,y,z~N....~Iright?~N
  384. .W
  385. .R18C1
  386.     ~IWRONG! WRONG! WRONG!~N
  387.     In here goes the ~Iaddresses~N of the variables, like ~b~I&x,&y,&z~N!
  388.  
  389. ~V~BNOTE: These addresses are  called  ~Rpointers~B,  because  they 'point'~N
  390. ~V~B      to the memory locations which are reserved for the variables.~N
  391. .W
  392. .N
  393. .T
  394.   some final comments about printf() and scanf()  
  395. .R4C1
  396.     We saw, earlier in this lesson, the statement:
  397.  
  398. ~b~Iprintf("the answer is ~V%6~N~bd",x);~N
  399.                                  
  400.     We may specify the number of screen positions (the ~Ifield width~N) which the
  401.     number is to occupy when ~b~Iprintf()~N is invoked (in the above
  402.     example, it's ~b~I6~N positions). For an ~b~Iint~Neger, that's all
  403.     that's necessary, but for a ~b~Ifloat~Ning point number we may also
  404.     specify the number of digits after the decimal. If we just say ~b~I%f~N
  405.     then we will get ~I6~N decimal places (remember ~r~Iy=-2.000000~N?).
  406. .W
  407. .R15C1
  408. ~b~Iprintf("the answer is ~V%6.3~N~bf",x);~N
  409.  
  410.     In this statement, if ~b~Ix~N were a ~b~If~Nloat and equal to ~I12.3456~N
  411.     then what do you think would be printed?
  412. .W
  413. .R20C1
  414. ~r~Ithe answer is 12.346~N        rounded to ~I3~N decimal places!
  415. .W
  416. .N
  417. ~b~Imain() {~N
  418. ~b~Ifloat x;~N
  419. ~b~Ix=-12.3456;~N
  420. ~b~Iprintf("x=%6.3",x);~N
  421. ~b~I}~N
  422.     Note that ~b~Ix=-12.3456~N ~Icannot~N be printed in ~b~I6~N positions
  423.     with ~b~I3~N decimal places. The first ~b~I6~N positions would give 
  424.     only ~r~Ix=-12.34~N (or ~r~Ix=-12.35~N if rounded). But ~b~Iprintf()~N
  425.     is a smart guy (gal?) and ~V~Bincreases the field width as necessary~N
  426.     ...and prints:
  427.  
  428. ~r~Ix=-12.346~N
  429.  
  430.     For numbers (either ~b~Iint~N or ~b~Ifloat~N) the ~Ifield width~N is
  431.     understandable....but what about ~b~Ichar~N variables which are single
  432.     characters and will only occupy ~Ione~N screen position anyway?
  433.  
  434. ~b~Ix='Z';~N                        What do you think
  435. ~b~Iprintf("x=%6c",x);~N            this will print?
  436. .W
  437. .R22C1
  438. ~r~Ix=     Z~N     the ~IZ~N is right-justified in a field width of ~I6~N!
  439. .WNT
  440.     ...and then there's CAST   
  441.  
  442.  
  443.     Suppose you desparately need to have an ~b~Iint~Neger variable converted
  444.     to a  ~b~Ifloat~Ning point number. Maybe you wanted to compute the sine
  445.     of an ~b~Iint~N called ~b~Ix~N. Using ~b~Isin(x)~N is no good because the
  446.     ~Isin(x)~N function only works for ~Ifloat~Ning ~b~Ix~N.
  447.  
  448.     You could use a "spare" ~b~Ifloat~N variable, say ~b~I float y; ~N, and
  449.     say:
  450.  
  451.     ~b~I y=x; ~N  (which does an ~Iautomatic conversion~N when it assigns
  452.                    the x-value to y, from ~b~Iint~N to ~b~Ifloat~N)
  453.     then use:
  454.  
  455.     ~b~Isin(y)~N  (which is OK since ~b~Iy~N is now a ~b~Ifloat~N)
  456.  
  457.     ~IOR~N, rather than having to declare ~b~I float y; ~N just to have ~b~Iy~N
  458.     in reserve for this "conversion" purpose, you may use the CAST.
  459. .WK10,32
  460.  a CAST?
  461. .WN
  462.  
  463.  
  464.     ~b~Isin( (float)x )~N  will temporarily convert the ~b~I int~Neger ~b~Ix~N
  465.                            to a ~b~Ifloat~N (for purposes of computing the
  466.                            ~b~Isin~N) but ~Ileave x unchanged~N.
  467.  
  468.     This is called a CAST (in C-speak).
  469. .W
  470.  
  471. ~b~Iint x;~N
  472. ~b~Ix=10;~N
  473. ~b~Iprintf("Here's an integer, printed to 6 decimal places! %f",~V(float)~N~b~Ix);~N
  474.  
  475.     The above reCASTs the ~b~Iint~Neger ~b~Ix~N for ~b~Iprintf~Ning as a 
  476.     ~b~I%f~Nloat, and you get the output:
  477.  
  478.     ~r~IHere's an integer, printed to 6 decimal places! 10.000000~N
  479.  
  480.     ...and of course you may refer to ~b~I(int)y~N to provide an ~b~Iint~Neger
  481.     copy of ~b~Iy~N (without changing ~b~Iy~N herself).
  482. .K19,60
  483. fantastico
  484. .WNT
  485.     ...a final note on DATA TYPES       
  486.  
  487.     We have talked about numbers stored (in memory) in ~b~Iint~N and ~b~Ifloat~N
  488.     format. Whereas the ~b~Iint~N format can represent an integer in the range
  489.     -32768 to 32767 (with sign) and the ~b~Ifloat~N format can hold a number with
  490.     6 significant figures  (roughly) we also can declare a number to be ~b~Idouble~N
  491.     which is an ~Iextended~N floating point number and gives (about) 13 significant
  492.     figures.
  493.  
  494.     Also, we can have an integer which runs from 0 to 65535 by declaring it to
  495.     be an ~b~Iunsigned int~N (which then is always non-negative). Although
  496.     this ~Itype~N occupies the same memory space as ~b~Iint~N, dropping the
  497.     'sign' allows for double the magnitude of integer.
  498.  
  499.     We can also have a ~b~Ilong int~N which occupies twice as much memory
  500.     and can represent integers from (about) -2,000,000,000 to 2,000,000,000.
  501.  
  502. .b21-23
  503. .R22C8
  504. The sizes given above, may differ from one machine to another!
  505. .WN
  506.  
  507.  
  508.  
  509. .T
  510.   That's all folks!  
  511. .K16,32
  512. au revoir!
  513.  
  514. .q
  515.  
  516.